Skip to content

Conversation

@rachelmcr
Copy link
Contributor

@rachelmcr rachelmcr commented Dec 7, 2022

Closes: #8323

Description

Updates the used_analytics event to include the following interactions in the Analytics Hub:

  • Scrolling
  • Pull-to-refresh
  • Tapping on the date range
  • Selecting a date range option

Changes

The used_analytics event is handled by StoreStatsUsageTracksEventEmitter:

  • We pass an instance of StoreStatsUsageTracksEventEmitter into the Analytics Hub (and its subviews) from the dashboard.
  • We call its interacted() method when the user does one of these interactions, to trigger the event.

Most of the interactions should be straightforward, but a note about scrolling: SwiftUI doesn't have a straightforward way of identifying the scroll gesture. Instead, we can use DragGesture to know when scrolling begins, which is sufficient for this tracking.

Testing

Note: The used_analytics event is not triggered immediately after an interaction. (Currently, you have to perform 5 interactions and interact for at least 10 seconds before the event will be triggered.)

For testing, I recommend placing breakpoints where usageTracksEventEmitter.interacted() is called:

  • AnalyticsHubView on L59 and L121
  • AnalyticsTimeRangeCard on L31 and L40

To test:

  1. Launch the app.
  2. Tap "See more" on the My Store dashboard.
  3. Scroll the Analytics screen and confirm you hit the breakpoint in AnalyticsHubView on L121. (You can then disable this breakpoint to make it easier to scroll.)
  4. Pull to refresh the Analytics screen and confirm you hit a breakpoint.
  5. Tap the date range selector and confirm you hit a breakpoint.
  6. Select a new date range and confirm you hit a breakpoint.

You can also check that after at least 5 of these interactions and 10 seconds you see the used_analytics event triggered.

Submitter Checklist

Update release notes:

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@rachelmcr rachelmcr force-pushed the issue/8323-analytics-hub-used-analytics-event branch from 8c5a3c6 to 0a852a1 Compare December 7, 2022 18:15
@rachelmcr rachelmcr added the category: tracks Related to analytics, including Tracks Events. label Dec 7, 2022
@rachelmcr rachelmcr added this to the 11.6 milestone Dec 7, 2022
@rachelmcr rachelmcr linked an issue Dec 7, 2022 that may be closed by this pull request
@rachelmcr rachelmcr marked this pull request as ready for review December 7, 2022 18:19
@rachelmcr rachelmcr requested review from Ecarrion, ThomazFB and ealeksandrov and removed request for ThomazFB and ealeksandrov December 7, 2022 18:19
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 7, 2022

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr8337-2df386d on your iPhone

If you need access to App Center, please ask a maintainer to add you.

Base automatically changed from issue/8323-analytics-hub-standard-tracks-events to trunk December 8, 2022 11:43
@peril-woocommerce
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 2 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@ThomazFB ThomazFB self-assigned this Dec 8, 2022
Copy link
Contributor

@ThomazFB ThomazFB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling the tracks, @rachelmcr! I've tested the behavior alongside the Android implementation. Both platforms look aligned with the expected triggers! Even the annoyance to trigger them 😆 LGTM!

@rachelmcr rachelmcr merged commit dfa7a73 into trunk Dec 8, 2022
@rachelmcr rachelmcr deleted the issue/8323-analytics-hub-used-analytics-event branch December 8, 2022 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: tracks Related to analytics, including Tracks Events.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Analytics Hub] Add Tracks events

4 participants